using System;
using System.Collections.Generic;
using System.Text;

namespace ErlyThreads.ChangeLog
{

    [global::System.Serializable]
    public class NoGoogleCodeIssueNumberException : ApplicationException
    {
        //
        // For guidelines regarding the creation of new exception types, see
        //    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconerrorraisinghandlingguidelines.asp
        // and
        //    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp07192001.asp
        //

        public NoGoogleCodeIssueNumberException() { }
        protected NoGoogleCodeIssueNumberException(
          System.Runtime.Serialization.SerializationInfo info,
          System.Runtime.Serialization.StreamingContext context)
            : base(info, context) { }
    }


    [global::System.AttributeUsage(AttributeTargets.Assembly, Inherited = false, AllowMultiple = true)]
    sealed class ChangeLogAttribute : Attribute
    {
        // See the attribute guidelines at 
        //  http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconusingattributeclasses.asp
        

        // This is a positional argument.
        public ChangeLogAttribute(
            int pYear, int pMonth, int pDay,
            int pMajor, int pMinor, int pBuild, int pRevision,
            string pMessage)
        {
            this.mChangeDate = new DateTime(pYear, pMonth, pDay);
            this.mForVersion = new Version(pMajor, pMinor, pBuild, pRevision);
            this.mMessage = pMessage;
        }

        int? mGoogleCodeIssueNumber = null;
        public int GoogleIssueNumber
        {
            get 
            {
                if (mGoogleCodeIssueNumber == null)
                {
                    throw new NoGoogleCodeIssueNumberException();
                }
                else
                {
                    return mGoogleCodeIssueNumber.Value;
                }
            }
            set { mGoogleCodeIssueNumber = value; }
        }

        public bool HasGoogleIssueNumber
        {
            get { return mGoogleCodeIssueNumber.HasValue; }
        }

        readonly DateTime mChangeDate;
        public DateTime ChangeDate
        {
            get
            {
                return this.mChangeDate;
            }
        }

        private Version mForVersion;
        public Version ForVersion
        {
            get { return mForVersion; }
        }

        private string mMessage;
        public string Message
        {
            get { return mMessage; }
        }

    }
}
